#pragma once
#ifdef WIN32
#include <Windows.h>
#else
#pragma GCC diagnostic ignored "-Wwrite-strings"
#endif

template <typename T>
class TSingleton
{
public:
	virtual ~TSingleton()
	{
		if (_instance)
		{
			_instance = 0;
		}
	}
	static T *getInstance() 
	{
		if (!_instance)
			_instance = new T;
		return _instance;
	}

protected:
	TSingleton(){}
	TSingleton(const TSingleton<T>&){}
	TSingleton<T>& operator=(const TSingleton<T>&){}

	static T *_instance;
};

template<typename T>
T *TSingleton<T>::_instance = 0;